package com.seray.zebraprintlib;

import com.zebra.sdk.printer.discovery.DiscoveredPrinter;
import com.zebra.sdk.printer.discovery.DiscoveredPrinterUsb;
import com.zebra.sdk.printer.discovery.DiscoveryHandler;

import java.util.LinkedList;
import java.util.List;

/**
 * Author：李程
 * CreateTime：2018/8/7 21:43
 * E-mail：licheng@kedacom.com
 * Describe：查找打印机
 */
public class UsbDiscoveryHandler implements DiscoveryHandler {

    List<DiscoveredPrinterUsb> printers;

    boolean discoveryComplete = false;

    UsbDiscoveryHandler() {
        printers = new LinkedList<>();
    }

    public void foundPrinter(final DiscoveredPrinter printer) {
        printers.add((DiscoveredPrinterUsb) printer);
    }

    public void discoveryFinished() {
        discoveryComplete = true;
    }

    public void discoveryError(String message) {
        discoveryComplete = true;
    }
}
